package org.jsola.hr.web;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.jsola.admin.vo.HeaderFieldsVO;
import org.jsola.core.Page;
import org.jsola.core.Result;
import org.jsola.hr.dto.HrCustomerDetailsNewAddDTO;
import org.jsola.hr.query.HrEmployeeSalaryNewQuery;
import org.jsola.hr.query.HrEmployeeSalaryQuery;
import org.jsola.hr.vo.HrMonthlySalarySummaryNewVO;
import org.jsola.hr.vo.JfStatisticsAnalyseVO;
import org.jsola.salary.entity.CustomerDetailsNewDO;
import org.jsola.salary.vo.CustomerDetailsNewVO;
import org.jsola.salary.vo.EmployeeDetailsNewVO;
import org.springframework.core.io.Resource;
import org.springframework.http.ResponseEntity;

import javax.validation.Valid;
import java.util.List;

/**
 * 客户明细表
 *
 * @author JanusMix
 */
@Api(tags = "salary-客户明细表")
public interface IHrCustomerDetailsNewControllerAPI {

    /**
     * 根据公司Ids新增客户明细表
     *
     * @param hrCustomerDetailsNewAddDTO 新增客户明细表DTO
     * @return 客户明细表详情信息
     */
    @ApiOperation(value = "根据公司Ids新增客户明细表")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "hrCustomerDetailsNewAddDTO", dataType = "HrCustomerDetailsNewAddDTO", value = "新增客户明细表", paramType = "body")
    })
    Result<List<CustomerDetailsNewVO>> saveByCompanyIds(HrCustomerDetailsNewAddDTO hrCustomerDetailsNewAddDTO);

    /**
     * 批量删除客户明细表，逻辑删除
     *
     * @param customerDetailsNewIds 客户明细表id集合
     * @return 删除数量
     */
    @ApiOperation(value = "批量删除客户明细表，彻底删除")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "customerDetailsNewIds", dataType = "Long[]", value = "客户明细表id数组", paramType = "body", allowMultiple = true)
    })
    Result<Integer> deleteBatch(Long[] customerDetailsNewIds);

    /**
     * 查询创建的最后一个月客户明细
     *
     * @return 公司创建的最后一个月汇总
     */
    @ApiOperation(value = "查询创建的最后一个月客户明细")
    Result<CustomerDetailsNewDO> selectLastOne();

    /**
     * 查询租户下分管用工单位的客户明细汇总
     *
     * @param yearly              年
     * @param monthly             月
     * @param customerDetailsType 类型;客户/薪资/社保明细
     * @return 客户明细汇总
     */
    Result<Page<HrMonthlySalarySummaryNewVO>> selectSalarySummaryBySiteAndMonthly(Integer yearly, Integer monthly
            , String customerDetailsType, String companyId, String companyName, Integer pageNo, Integer pageSize);

    /**
     * 查询租户下自定义分组的客户明细汇总
     *
     * @param yearly              年
     * @param monthly             月
     * @param customerDetailsType 类型;客户/薪资/社保明细
     * @return 客户明细汇总
     */
    Result<Page<HrMonthlySalarySummaryNewVO>> selectCustomGroupingBySiteAndMonthly(Integer yearly, Integer monthly
            , String customerDetailsType, Integer pageNo, Integer pageSize);

    /**
     * 查询客户明细表头
     *
     * @param hrEmployeeSalaryQuery 导出动态参数
     * @return 客户明细表头
     */
    @ApiOperation(value = "查询客户明细表头")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "hrEmployeeSalaryQuery", dataType = "HrEmployeeSalaryQuery", value = "导出动态参数", paramType = "body")
    })
    Result<HeaderFieldsVO> selectHeaderDetailNew(HrEmployeeSalaryQuery hrEmployeeSalaryQuery);

    /**
     * 查询员工的客户明细
     *
     * @param hrEmployeeSalaryNewQuery 查询条件
     * @return 员工的客户明细
     */
    @ApiOperation(value = "查询员工的客户明细")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "hrEmployeeSalaryQuery", dataType = "HrEmployeeSalaryQuery", value = "查询条件", paramType = "query")
    })
    Result<Page<EmployeeDetailsNewVO>> selectEmployeeDetailsPageByCompanyIdsNew(HrEmployeeSalaryNewQuery hrEmployeeSalaryNewQuery);


    /**
     * 客户明细表导出
     *
     * @param hrEmployeeSalaryNewQuery 导出动态参数
     * @return excel
     */
    @ApiOperation(value = "客户明细表导出excel")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "hrEmployeeSalaryNewQuery", dataType = "HrEmployeeSalaryNewQuery", value = "导出动态参数", paramType = "body")
    })
    ResponseEntity<Resource> exportNew(HrEmployeeSalaryNewQuery hrEmployeeSalaryNewQuery);

    /**
     * 人力成本统计分析
     *
     * @param companyId 用工单位Id
     * @param yearly    年
     * @return 统计分析结果
     */
    Result<JfStatisticsAnalyseVO> jfStatisticsAnalyseLaborCosts(String companyId, Integer yearly);
}
